 {extend name="base" /} {block name="css"}
<link rel="stylesheet" href="/public/static/layui/css/layui.css" media="all"> {/block} {block name="body"}
<div class="layui-body" id='test1'>
	<!--tab标签-->
	<div class="layui-tab layui-tab-brief">
		<ul class="layui-tab-title">
			<li class="layui-this">会员管理</li>
			<li  class="layui-this"><a href="{:url('member/add')}">添加会员</a></li>
		</ul>
		<div class="layui-tab-content">
			<div>
				
			</div>
			<table class="layui-table">
				<thead>
					<tr>
						<th>ID</th>
						<th>账号(手机号)</th>
						<th>昵称</th>
						<th>性别</th>
						<th>注册时间</th>
						<th>操作</th>
					</tr>
				</thead>
				<tbody>
					{foreach name="list" item="vo"}
					<tr>
						<td>{$vo.id}</td>
						<td>{$vo.mobile}</td>
						<td>{$vo.name}</td>
						<td>{$vo.sex==1?'男':'女'}</td>
						<td>{$vo.add_time}</td>
						<td>
							<a href="{:url('edit',['id'=>$vo['id']])}" class="layui-btn layui-btn-normal layui-btn-small">编辑</a>
							<a id='delete' onclick="del('{$vo.id}')" class="layui-btn layui-btn-normal layui-btn-small">删除</a>
						</td>
					</tr>
					{/foreach}
				</tbody>
			</table>
			{$list->render()}
			<div>
				<table id="demo" lay-filter="test"></table>
			</div>
		</div>
	</div>

</div>
<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
<script>
	function del(obj) {
		layer.confirm('确认要删除吗?', {
		  btn: ['确认', '取消'],//可以无限个按钮,
		}, function(index){
			$.ajax({
				type:"post",
				url: "{:url('member/delete')}",
				data: {id :obj},//表单数据
				success: function(data) {
					layer.msg(data.msg,function(index){
						location.href=data.url;
						
						
					});
					
				}
			});
		  
		});
	
			}
</script>
{/block}